﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Project_KhuyenMaiVang.DAO;
using Project_KhuyenMaiVang.Models;

namespace Project_KhuyenMaiVang.Controllers
{
    public class CommentController : Controller
    {
        //
        // GET: /Comment/
        public ActionResult Edit(int maTin, int idAccount, string noiDung)
        {
            CommentDAO commentDAO = new CommentDAO();
            CommentDTO commentInfo = commentDAO.getCommentBy(maTin, idAccount, noiDung);
            return View(commentInfo);
        }
        [HttpPost]
        public ActionResult Edit(CommentDTO comment)
        {
            CommentDAO commentDAO = new CommentDAO();
            commentDAO.updateComment(comment);
            return View();
        }

        public ActionResult Delete(int maTin, int idAccount, string noiDung)
        {
            CommentDAO commentDAO = new CommentDAO();
            commentDAO.delete(maTin, idAccount, noiDung);
            return RedirectToAction("QuanLyComment", "Admin");
        }
    }
}
